/**
 * 函数作用域的使用
 */

var a = 10
let b = 1


function sum() {

    a  = 11
    b = 2

    var c = 90
    let d = 3

    console.log(a) // 11
    console.log(b) // 2
    console.log(c) // 90
    console.log(d) // 3

}

console.log(a) // 10
console.log(b) // 1
// console.log(c) // ReferenceError c is not defined
// console.log(d) // ReferenceError d is not defined


sum()
console.log(a) // 11
console.log(b) // 2
// console.log(c) // ReferenceError c is not defined
// console.log(d) // ReferenceError d is not defined


function one() {
    var one1 = 'one'
    console.log(one1)
}

one()              // 不管这里有没有被执行， 全局作用域中都没有one1这个变量
// console.log(one1)  // ReferenceError one1 is not defined


// function two(){
//     var two2 = 'two2'
//     console.log(two2)
// }


